package com.ITArmy.dao;

import com.ITArmy.beans.Comment;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface CommentMapper {
    int deleteByPrimaryKey(Long cId);

    int insert(Comment record);

    int insertSelective(Comment record);

    Comment selectByPrimaryKey(Long cId);

    int updateByPrimaryKeySelective(Comment record);

    int updateByPrimaryKey(Comment record);

    List<Comment> findCommentBySerialize(@Param("serializeId") long serializeId);

    List<Comment> findCommentByBlogId(@Param("bid") Long bid);

    List<Comment> findCommentByQuestionId(Long qid);

    /**
     * 通过uid和时间查找评论
     * @param uid uid
     * @param date date
     * @return int
     */
    Comment findCommentByUidAndTime(@Param("uid") Long uid,@Param("date") Date date);

    List<Comment> findCommentByBid(long bid);

    /**
     *删除博客id对应的所有评论信息
     * @param bid bid
     * @return int
     */
    int deleteCommentByBid(long bid);

    /**
     *查询一段时间之内的评论
     * @param startdate s
     * @param enddate e
     * @return list
     */
    int findCommentBetweenTime(@Param("uid")long uid,@Param("startdate") Date startdate,@Param("enddate") Date enddate);

}